﻿<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{$infoConfig.site_title}</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<!-- load css -->
<link rel="stylesheet" href="/admin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="/admin/font/iconfont.css?v=1.0.0" type="text/css" media="all">
<link rel="stylesheet" href="/admin/css/adaption.css" type="text/css">
<style>
.kzt{height:50px;line-height:50px;background:#2B2E37;text-indent:10px;}
.kzt a{ color:#FFF; margin-left:9px;}
.admin-iframe{width: 100%;border: 0;height: 100%;}
#admin-tab .layui-tab-title .layui-this {background: #1FA094;background: linear-gradient(#1FA094, #009688);color: #FFF;}
#admin-tab .layui-tab-title li:hover{ background-color:#009688; color:#fff; position:relative;}
#admin-tab .layui-tab-title li .close{display:block;width:16px;height:14px;background-image:url('/admin/images/header.jpg'); background-repeat:no-repeat; background-position:center; position:absolute; top:0;right:0;}
#admin-tab .layui-tab-title li:hover .close{ background-color:#fff;}
</style>
</head>

<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">{$infoConfig.site_title}</div>
		<ul class="layui-nav layui-layout-left" id="menu" lay-filter="main-menu">
			{volist name="list" id="vo"}
			<li class="layui-nav-item {if $key==0}layui-this{/if}">
				<a href="javascript:;"><span>{$vo.name}</span></a>
			</li>
			{/volist}
		</ul>
		<ul class="layui-nav layui-layout-right">
			<li class="layui-nav-item" style="margin-right: 10px;">
				<a href="javascript:;">
				<img src="/admin/images/header.jpg" class="layui-nav-img">
				{if $loginUserInfo.nickname!=''}{$loginUserInfo.nickname}{else/}{$loginUserInfo.username}{/if}
				</a>
				<dl class="layui-nav-child">
					<dd><a href="javascript:;" class='layui-submit' data-type="del" data-name='退出' data-url='{:url("index/logout")}'>安全退出</a></dd>
					{volist name="listGuide" id="vo"}
					<dd><a href="{$vo.url}" target="_blank">{$vo.name}</a></dd>
					{/volist}
				</dl>
			</li>
			<!--<li class="layui-nav-item"><a href="javascript:;" class='layui-submit' data-type="clear" data-name='清理缓存' data-url='{:url("index/delcache")}'>清理缓存</a></li>-->
			<li class="layui-nav-item"><button title="刷新" class="layui-btn layui-btn-normal layui-refresh"><i class="layui-icon">&#xe669;</i></button></li>
		</ul>
		
    </div>
	<!-- /头部结束 -->

    <!-- 左侧导航(垂直导航) -->
    <div id="left-nav" class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!--子菜单项-->
            <p class='kzt' fold='1'>
                <a href="javascript:;" class='left-menu' data-title="控制台">
					<i class="layui-icon">&#xe665;</i>
                    <span>控制台</span>
                </a>
            </p>
            <div id="submenu">
				{volist name="listSub" id="vo"}
				<div class="sub-menu" {if $key>0}style="display:none"{/if} >
					<ul class="layui-nav layui-nav-tree">
						{volist name="vo['list_sub']" id="sub"}
							{if !empty($sub['sub_voo'])}
							<li class="layui-nav-item layui-nav-itemed" data-bind="0">
								<a href="javascript:;" data-title="{$sub.name}">
									<span>{$sub.name}</span>
									<em class="layui-nav-more"></em>
								</a>
								<dl class="layui-nav-child">
									{volist name="sub['sub_voo']" id="voo"}
									<dd class="dataurl">
										<a href="javascript:;" data-url="/{$voo.url}" data-title="{$voo.name}">
											<span>{$voo.name}</span>
										</a>
									</dd>
									{/volist}
								</dl>
							</li>
							{else/}
							<li class="layui-nav-item dataurl">
								<a href="javascript:;" data-url="/{$sub.url}" data-title="{$vo.name}">
									<span>{$sub.name}</span>
								</a>
							</li>
							{/if}
						{/volist}
					</ul>
				</div>
				{/volist}
			</div>
        </div>
    </div>
    <!-- /左侧侧边导航结束 -->
	
    <!-- 右侧主体内容 -->
    <div class="layui-body">
        <div class="layui-tab layui-tab-card jqadmin-tab-box" id="admin-tab" lay-filter="tabmenu" lay-notAuto="true">
            <ul class="layui-tab-title" {if $version == 1}style='display:none;'{/if}>
                <li class="layui-this" id="admin-home"><i class="layui-icon">&#xe68e;</i> <em>管理首页</em></li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show" id="right-content">
                    <iframe class="admin-iframe" name="mhsh_iframe" id="mhsh_iframe" data-id='0' src="{:url('home/main')}"></iframe>
                </div>
            </div>
        </div>
    </div>
    <!-- 底部区域 -->
    <div class="layui-footer">
        <div class="layui-mian">
            <span class="layui">2018 &copy;</span>
			<span class="layui">{$infoConfig.site_copyright}</span>
        </div>
    </div>
</div>
</body>
<!-- / -->
<script src="/admin/layui/layui.js"></script>
<script>
layui.config({
	base: '/admin/js/',
	version : true,
}).use('tabmenu');
layui.use(['jquery','layer'], function(){
	var $ = layui.jquery
	,layer = layui.layer;
	
	//<!-- /头部区域(水平导航) 点击监听 -->
	$('#menu .layui-nav-item').on('click', function(){
		var num = $(this).index();
		console.log('top-nav',num);
		
		//顶部主菜单
		$('#menu .layui-nav-item').removeClass('layui-this');
		$('#menu .layui-nav-item:eq('+num+')').addClass('layui-this');
		
		//左侧子菜单
		$('.sub-menu').css('display','none');
		$('.sub-menu:eq('+num+')').css('display','block');
		$('#submenu .layui-nav-item').removeClass('layui-this');
	});
	
	$('#submenu .dataurl').on('click', function(){
		var dataurl = $(this).children('a').attr('data-url');
		console.log('act',dataurl);
		
		//单页版
		$("#admin-tab .layui-tab-title").css('display','none');
		$("#mhsh_iframe").attr("src", dataurl);
	});
	
	//通用按钮监听事件
	$('.layui-submit').on('click', function(){
		var type = $(this).attr('data-type');	//必填 del add edit clear
		var url = $(this).attr('data-url');		//必填
		var name = $(this).attr('data-name');	//必填
		var field = $(this).attr('data-field');
		var value = $(this).attr('data-value');
		//console.log(type);
		if (typeof(type) != 'undefined') {
			layer.open({
				type: 1
				,title:'提示'
				,content: '<div style="padding:20px 100px;">确认 '+name+' 操作吗？</div>'
				,btn: '确定'
				,btnAlign: 'c' //按钮居中
				,shade: 0 //不显示遮罩
				,yes: function(index){
					if(typeof(field) != 'undefined'){
						var data = {};
						data[field] = value; 
					}else{
						var data = {};
						data['id'] = 1; 
					}
					
					console.log(name,url);
					
					$.ajax({
						url: url,
						data: data,
						type: "post",
						dataType:'json',
						success:function(res){
							console.log(res);
							//数据处理
							layer.close(index);
							if(res.code==1){
								//返回OK 正常信息 
								layer.msg(res.msg, {icon:1,time:1000}, function(index){
									//location.reload();
								});
							}
							if(res.code==2){
								//返回OK 临时性重定向
								layer.msg(res.msg, {icon:1,time:1000}, function(index){
									window.location.href = res.data;
								});
							}
							if(res.code==0){
								//返回Error 返回错误
								layer.msg(res.msg, {icon:2,time:2000}, function(index){
									
								});
							}
						}
					});
				}
			});
		};
	});
	
});

</script>
</html>